package com.jinglvhuanjing.app.adapter;

import androidx.appcompat.widget.AppCompatTextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jinglvhuanjing.app.R;
import com.jinglvhuanjing.app.bean.SheetBottomBean;
import com.jinglvhuanjing.app.listener.SheetClickEvent;

public class SheetAdapter extends BaseMultiItemQuickAdapter<SheetBottomBean , BaseViewHolder> {
    public SheetAdapter(){
        addItemType( 0 , R.layout.item_sheet_bottom_list);
    }

    private SheetClickEvent sheetClickEvent;

    public void setButtonClickEvent(SheetClickEvent sheetClickEvent){
        this.sheetClickEvent = sheetClickEvent;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, SheetBottomBean sheetBottomBean) {
        AppCompatTextView item = baseViewHolder.getView(R.id.item_text);
        item.setText(""+sheetBottomBean.getLabel());

        item.setOnClickListener(view -> {
            if(sheetClickEvent==null){
                return;
            }
            sheetClickEvent.buttonClick(sheetBottomBean);
        });

    }
}
